package com.ruoyi.project.app.aspect.handler;

import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.project.app.anno.CheckUser;

import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Parameter;

public class CheckUserHandler implements Handler {
    @Override
    public boolean handler(AnnotatedElement element, Object obj) {
        CheckUser checkUser = null;
        if(element instanceof Parameter){
            Parameter  parameter = (Parameter) element;
            checkUser = parameter.getAnnotation(CheckUser.class);
        }else if(element instanceof Field){
            Field field = (Field) element;
            checkUser = field.getAnnotation(CheckUser.class);
        }
        if(checkUser!=null){
//            if(null==SpringUtils.getBean(IAppUserService.class).selectAppUserById((Long)obj)){
//                throw new RuntimeException(checkUser.msg());
//            }
        }
        return false;
    }
}
